"""
Author: runyu.ma

dslc_import_lib_pass.py
"""

import os
import sys
import importlib.util


def import_pyfile(fpath):
    '''导入python lib'''
    fname = os.path.basename(fpath)
    fname = fname.split('.')[0]
    spec = importlib.util.spec_from_file_location(fname, fpath)
    module = importlib.util.module_from_spec(spec)
    sys.modules[fname] = module
    spec.loader.exec_module(module)
    #print(module.copy_bunch('.', '.', '.'))
    return module
